﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CAUNetLogin.Util.Security
{
    /// <summary>
    /// SimpleSecurity提供了简单的双向加密解密方式
    /// </summary>
    public class SimpleSecurity
    {
        /// <summary>
        /// 简单加密
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string Encode(string str)
        {
            string htext = "";
            for (int i = 0; i < str.Length; i++)
            {
                htext = htext + (char)(str[i] + 8);
            }
            return htext;
        }
        /// <summary>
        /// 简单解密
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string Decode(string str)
        {
            string dtext = "";
            for (int i = 0; i < str.Length; i++)
            {
                dtext = dtext + (char)(str[i] - 8);
            }
            return dtext;
        }
    }
}
